def transformList(lst: List[Int]): List[Int] = {
  lst.map(num => if(num % 2 == 0) num / 2 else num + 1)
}

// 测试
val list1 = List(1, 2, 3, 4, 5)
val list2 = List(6, 7, 8, 9, 10)
println(transformList(list1))
println(transformList(list2))
